package com.ftwj.demo.config.solr;

import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ftwj.demo.utils.logs.LoggerUtil;

@Configuration
public class SolrConfig {
    @Value("${spring.data.solr.host}")
    private String solrHost;

    @Bean
    public HttpSolrClient solrClient() {
        HttpSolrClient client = new HttpSolrClient.Builder(solrHost).withConnectionTimeout(10000).withSocketTimeout(60000).build();
        if(client==null) {
        	LoggerUtil.info("创建Solr服务器连接：成功！");
        }
        return client;
    }
    
    /*
    @Bean
	 public SolrTemplate solrTemplate(SolrClient client) {
	    return new SolrTemplate(client);
	}
	*/
}
